package com.sns.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sns.dao.UserInfoDao;
import com.sns.model.UserInfo;
import com.sns.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserInfoServiceImpl implements UserService {
    @Autowired
    private UserInfoDao userInfoDao;
    @Override
    public Integer addUser(UserInfo u) {
        return userInfoDao.insertUser(u);
    }

    @Override
    public PageInfo<UserInfo> findAllUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<UserInfo> lu=userInfoDao.getUsers();
        PageInfo result=new PageInfo(lu);
        return result;
    }
}
